package nz.ac.massey.cs.domain;

import nc.ac.massey.cs.plugin.ManagePlugins;
import nz.ac.massey.cs.persistency.Sudoku_reader;
import nz.ac.massey.cs.persistency.Sudoku_reader.result;

public class SudokuFactory {
	public static String sudokuType = "";
	
	/*
	 * builds a sudoku from the file
	 */
	public static ISudoku buildSudoku(String fileName)
	{
		Sudoku_reader reader = Sudoku_reader.getInstance();	
		result result = reader.loadfile(fileName);
		String type = result.getTypeInfo().get("type");
		sudokuType = type;
		ISudoku sudoku = ManagePlugins.getsudokuplugins(type); // change later
		if(sudoku == null)
		{
			System.out.println("Sudoku Plugin not found");
		}
		else
		{
			sudoku.Build(reader.loadfile(fileName));
		}
		return sudoku;
	}
}
